//
//  LGLungFollowProjectCell.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2024/7/8.
//

#import "LGLungFollowProjectCell.h"

@interface LGLungFollowProjectCell()

/**   */
@property (nonatomic , strong)UILabel *contentLabel;

@end

@implementation LGLungFollowProjectCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.type = LGPositionTypeMiddle;
        [self createSubView];
    }
    return  self;
}

-(void)setDataDic:(NSDictionary *)dataDic{
    [super setDataDic:dataDic];
    if ([dataDic.allKeys containsObject:@"title"]) {
        self.contentLabel.text = LGNSString(dataDic[@"title"]);
    }else{
        self.contentLabel.text = LGNSString(dataDic[@"name"]);
    }
}

#pragma mark
#pragma mark ====> 创建控件
-(void)createSubView{
    [self.contentView addSubview:self.iconBtn];
    [self.contentView addSubview:self.contentLabel];
    [self.contentView addSubview:self.lineView];
    [self.iconBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(viewPix(28));
        make.centerY.equalTo(self.contentView);
        make.width.height.equalTo(@(viewPix(20)));
    }];
    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(viewPix(16));
        make.bottom.equalTo(self.contentView).offset(-viewPix(16));
        make.left.equalTo(self.iconBtn.mas_right).offset(viewPix(8));
        make.right.equalTo(self.contentView).offset(-viewPix(28));
    }];
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.iconBtn);
        make.right.equalTo(self.contentLabel);
        make.bottom.equalTo(self.contentView);
        make.height.equalTo(@(0.5));
    }];
}
-(UIButton *)iconBtn{
    if(!_iconBtn){
        _iconBtn = [UIButton buttonWithImage:@"unselect20" selectImage:@"selected20"];
        _iconBtn.userInteractionEnabled = NO;
    }
    return _iconBtn;
}
-(UILabel *)contentLabel{
    if(!_contentLabel){
        _contentLabel = [UILabel lableWithText:@"" colorString:@"#333333" textFont:LGFontWeight(16, UIFontWeightMedium) textAlignment:NSTextAlignmentLeft lines:0];
    }
    return _contentLabel;
}

-(UIView *)lineView{
    if(!_lineView){
        _lineView = [[UIView alloc]init];
        _lineView.backgroundColor = [UIColor colorWithString:@"#E0E0E0"];
    }
    return _lineView;
}

@end
